POV-Ray : Newsgroups : povray.binaries.images : Stupid math error : Re: Stupid math error Server Time
16 Aug 2024 08:19:48 EDT (-0400)
  Re: Stupid math error  
From: Timothy R  Cook
Date: 2 Apr 2002 18:01:29
Message: <3CAA384B.F4BF1CB8@scifi-fantasy.com>
25ct wrote:
> "Timothy R. Cook" <tim### [at] scifi-fantasycom> wrote:
> > I still find it easier to picture, at least, using vectorised'
> > versions.
> > e.g.
> > x = r*COS(t)
> > y = r*SIN(t)
> > t = TAN-1(x/y)
> > r = SQRT((x^2)+(y^2))
> 
> Tim, sorry, I'm now lost with this... I recognise it though. I think
> our teacher showed us the same?
> I could do with someone taking me through the basics again... Are
> you game? I'd appreciate it.

No problemmo.  I actually found vectors to be enjoyable.  Probably
the only part of math in high school I ever did like.  (Actually, I
originally was taught vectors in Physics, but...)

(Side note:  I use the right-hand rule, so Y is north, X is east)

+Y
|   . endpoint (distance r from origin)
|  /
| /., angle (theta)
|/   `,
+-------- +X

If you think about the vector in terms of x & y, you realise that
it's the hypoteneuse of a right triangle whose base and perpendicular
side are the axes.  So.  You get a right triangle:
      
       .
      /|
     / |
 r  /  | y
   /   |
  /   _|
 /?  | |
o------+
   x

Something about r: it's a radius of a circle with centre at o.
(Which is why I use 'r'.  The only reason I point this our is
'cuz when you rotate an object around a point, the other end
is going in a circle, and the angle is how far it's turned.)

Anyways.  If you know the angle and radius (as with velocity
vectors), the length of x is equal to the radius times the
cosine of the angle.  The length of y is equal to the radius
times the sine of the angle.  If you know x and y and want
to find the radius, use the Pythagorean theorem: a^2 + b^2 = c^2
(or, radius equals square root of x squared plus y squared).
The angle is the arctangent of x divided by y.

Vector addition simply strings together several vectors and
figures out the vector between start/end points.

This is helpful for making a CSG of a box of arbitrary size.
If I have a box at 0,0,0 and it has a scale of 1,2,0.5 and
I want to cut it in half diagonally along the xz surface,
how big do I need to make the differencing box, and how much
does it need to be rotated?  I know X and Y.  So.  It needs
to be SQRT((1^2)+(0.5^2)) along its x axis, or 1.11803399.
It needs to be rotated TAN-1(1/0.5), or 63.4349488 degrees.

-- 
Tim Cook
http://empyrean.scifi-fantasy.com

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GFA dpu- s: a?-- C++(++++) U P? L E--- W++(+++)>$
N++ o? K- w(+) O? M-(--) V? PS+(+++) PE(--) Y(--)
PGP-(--) t* 5++>+++++ X+ R* tv+ b++(+++) DI
D++(---) G(++) e*>++ h+ !r--- !y--
------END GEEK CODE BLOCK------


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.